//
//  SGLunchViewController.swift
//  songguo
//
//  Created by 潘传洲 on 16/6/3.
//  Copyright © 2016年 pcz. All rights reserved.
//

import UIKit

class SGLunchViewController: UIViewController {

    @IBOutlet weak var lunchImageView: UIImageView!
    override func viewDidLoad() {
        super.viewDidLoad()
        var images = [UIImage]()//launchA00_172x240_@1x
        
        for i in 0...28 {
            let istr = String(format: "%02d", i)
            let imageName = "launchA\(istr)_172x240_@1x"
            images.append(UIImage(named: imageName)!)
        }
        lunchImageView.image = UIImage(named: "launchA28_172x240_@1x")
        lunchImageView.animationImages = images
        lunchImageView.animationDuration = 2
        lunchImageView.animationRepeatCount = 1
        lunchImageView.startAnimating()
        
        performSelector(#selector(SGLunchViewController.loadMainViewController), withObject: nil, afterDelay: lunchImageView.animationDuration + 0.5)
    }
    
    func loadMainViewController(){
        let mainVC = SGMainViewController()
        UIApplication.sharedApplication().keyWindow?.rootViewController = mainVC
        
    }
}
